﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using LibDll;
using HelperUnity;

namespace IYASAKANet_CDDY
{
    public class SqliteOperation
    {
        private string strConn = string.Empty;

        public SqliteOperation(string conn)
        {
            strConn = conn;
        }

        /// <summary>
        /// 得到车型库数据.
        /// </summary>
        /// <returns></returns>
        public ReturnInfo<DataTable> GetVehicleInfoByModel(string strModel)
        {
            ReturnInfo<DataTable> ret = new ReturnInfo<DataTable>();
            try
            {
                SQLiteHelper sqLiteHelper = new SQLiteHelper();

                string strSql = "select * from VehicleTypeInfo where vehicleModel='"+ strModel + "'";

                var vConn = sqLiteHelper.GetSqliteConn(strConn);
                DataSet ds = sqLiteHelper.ExecuteDataSet(vConn, strSql, null);

                ret.Data = ds.Tables[0];
                ret.IsSuccess = true;
                ret.Message = "执行成功";
            }
            catch (Exception ex)
            {
                ret.Message = ex.Message;
                ret.IsSuccess = false;
            }

            return ret;
        }
    }
}
